/*
 * @Description:文件接口
 */
import request from '@/utils/request'
export default {
    //上传文件
    upload(data, callBack, index) {
        return request({
            url: '/portalWebsite/files/upload',
            method: 'POST',
            headers: {
                'Content-Type': 'multipart/form-data'
            },
            data,
            timeout: 0,
            onUploadProgress: progressEvent => {
                if (callBack) {
                    let process = (progressEvent.loaded / progressEvent.total * 100 | 0)
                    let progressText = `上传进度：${process}%`;
                    callBack({ label: progressText, process }, index)
                }
            }
        })
    }
};
